<template>
    <view class="app">
        <load :ready="ready"></load>
		<view class="content">
		    <u-parse :html="content"></u-parse>
		</view>
	</view>
</template>

<script>
import { mapState, mapActions, mapMutations, mapGetters } from 'vuex';
import { mixinsBase } from '@/common/js/mixins';
let that;
export default {
    mixins: [mixinsBase],
    components: {
	},
    data() {
        return {
           ready: false,
           info:{},
		   content:'',
           id:null
        };
    },
    onLoad(o) {
		this.getInit();
    },
    onReady() {
    },
    onUnload() {
        that = null;
    },
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function() {
        // this.getInit(data=>{
        //      uni.stopPullDownRefresh();
        //      common.showTip('刷新成功');
        // });
    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function() {},

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function() {
        //       return {
        // 	// path,
        // 	imageUrl:config.shareImg,
        // 	// title
        // }
    },
    methods: {
	async getInit(){
	    let res;
	    try{
	         res =  await this.$api.agreement();
	    }catch(e){
	         uni.hideLoading();
	         console.log(e)
	    }
	    if (res.data.code == this.$config.RESOK) {
	        this.content = res.data.data;
	        this.ready = true;
	    } else{
	        uni.showModal({
	            title: '提示',
	            content: res.data.msg,
	            showCancel: false,
	            confirmText: '好的',
	            success: res => {
	                this.goback();
	            },
	        });
	    }
	},
        ...mapActions([])
    },
    computed: {
        ...mapState({
            userInfo: 'userInfo'
        })
    }
};
</script>

<style scoped lang="scss">
page{
	background: #f5f5f5;
}
.content{
	padding: 30rpx;
}
</style>
